package edu.uoc.tds.pec4.vista;

import edu.uoc.tds.pec4.gestor.GestorInformes;
import edu.uoc.tds.pec4.model.SS1_TipoEvento;
import edu.uoc.tds.pec4.model.SS1_Usuario;
import edu.uoc.tds.pec4.model.SS3_InformeEventosAsistente;
import edu.uoc.tds.pec4.util.ComponentsUtils;
import edu.uoc.tds.pec4.util.ExceptionUtils;
import edu.uoc.tds.pec4.util.KeyValue;
import edu.uoc.tds.pec4.util.LanguageUtils;
import edu.uoc.tds.pec4.excepciones.FechasIncongruentesException;
import java.rmi.RemoteException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;

/**
 * Tecnicas de Desarrollo de Software - (UOC)
 * Clase que modela la pantalla de Informe de Eventos por Asistente
 * @author José Carlos Fernández Luque
 * @version 1.0
 */
public class SS3_PantallaEventosAsistente extends javax.swing.JPanel {

    private final DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    /**
     *
     */
    public float sumaImport;
    /**
     *
     */
    public GestorInformes objetoRemoto;
    private SS4_PantallaMenu aThis;
    private SS1_Usuario selectedUser;

    /**
     *
     * @param objetoRemoto
     */
    public SS3_PantallaEventosAsistente(GestorInformes objetoRemoto) {
        this.objetoRemoto = objetoRemoto;
        initComponents();
        formatLanguage();
        intialCharge();
    }

    /**
     *
     * @param aThis
     * @param objetoRemoto
     */
    public SS3_PantallaEventosAsistente(SS4_PantallaMenu aThis, GestorInformes objetoRemoto) {
        this.objetoRemoto = objetoRemoto;
        this.aThis = aThis;
        initComponents();
        formatLanguage();
        intialCharge();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel3 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        asistenteLabel = new javax.swing.JLabel();
        fechaDesdeLabel = new javax.swing.JLabel();
        fechaDesdeField = new javax.swing.JTextField();
        fechaHastaLabel = new javax.swing.JLabel();
        fechaHastaField = new javax.swing.JTextField();
        tipoEventotLabel = new javax.swing.JLabel();
        cleanButton = new javax.swing.JButton();
        tipoEventoCombo = new javax.swing.JComboBox();
        findButton = new javax.swing.JButton();
        statusEventLabel = new javax.swing.JLabel();
        assistantCombo = new javax.swing.JComboBox();
        statusEventCombo = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        resultScroll = new javax.swing.JScrollPane();
        resultTable = new javax.swing.JTable();
        titleLabel = new javax.swing.JLabel();

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Criterios de búsqueda"));

        asistenteLabel.setText("Asistente");

        fechaDesdeLabel.setText("Fecha desde");

        fechaHastaLabel.setText("Fecha Hasta");

        tipoEventotLabel.setText("Tipo Evento");

        cleanButton.setText("Limpiar");
        cleanButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cleanButtonActionPerformed(evt);
            }
        });

        tipoEventoCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        findButton.setText("Buscar");
        findButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findButtonActionPerformed(evt);
            }
        });

        statusEventLabel.setText("Estado Evento");

        assistantCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        statusEventCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(asistenteLabel)
                    .addComponent(fechaDesdeLabel)
                    .addComponent(statusEventLabel))
                .addGap(24, 24, 24)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(statusEventCombo, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(fechaDesdeField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(fechaHastaLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                        .addComponent(fechaHastaField, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(assistantCombo, javax.swing.GroupLayout.Alignment.TRAILING, 0, 260, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(cleanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(findButton, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(tipoEventotLabel)
                        .addGap(18, 18, 18)
                        .addComponent(tipoEventoCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(asistenteLabel)
                    .addComponent(tipoEventoCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(assistantCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tipoEventotLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(fechaDesdeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(fechaHastaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(fechaHastaLabel))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(fechaDesdeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(findButton)
                            .addComponent(cleanButton)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(14, 14, 14)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(statusEventLabel)
                            .addComponent(statusEventCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Resultados de la búsqueda"));

        resultTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Universidad del Evento", "Centro Evento", "Evento", "Tipo Evento", "Fecha Inicio", "Duracion", "Cerrado", "Estado Asistencia"
            }
        ));
        resultScroll.setViewportView(resultTable);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(resultScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 611, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(resultScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
                .addContainerGap())
        );

        titleLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        titleLabel.setText("Informe de Eventos de un Asistente");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(titleLabel)
                        .addGap(224, 224, 224))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(titleLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void findButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findButtonActionPerformed
        cercaResult();
    }//GEN-LAST:event_findButtonActionPerformed

    private void cleanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cleanButtonActionPerformed
        if (aThis == null) {
            assistantCombo.setSelectedIndex(0);
        }
        statusEventCombo.setSelectedIndex(0);
        tipoEventoCombo.setSelectedIndex(0);
        fechaDesdeField.setText("");
        fechaHastaField.setText("");
}//GEN-LAST:event_cleanButtonActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel asistenteLabel;
    private javax.swing.JComboBox assistantCombo;
    private javax.swing.JButton cleanButton;
    private javax.swing.JTextField fechaDesdeField;
    private javax.swing.JLabel fechaDesdeLabel;
    private javax.swing.JTextField fechaHastaField;
    private javax.swing.JLabel fechaHastaLabel;
    private javax.swing.JButton findButton;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane resultScroll;
    private javax.swing.JTable resultTable;
    private javax.swing.JComboBox statusEventCombo;
    private javax.swing.JLabel statusEventLabel;
    private javax.swing.JComboBox tipoEventoCombo;
    private javax.swing.JLabel tipoEventotLabel;
    private javax.swing.JLabel titleLabel;
    // End of variables declaration//GEN-END:variables

    private void formatLanguage() {
        asistenteLabel.setText(LanguageUtils.getMessage("SS3.asistente"));
        fechaDesdeLabel.setText(LanguageUtils.getMessage("SS3.fechaDesde"));
        fechaHastaLabel.setText(LanguageUtils.getMessage("SS3.fechaHasta"));
        findButton.setText(LanguageUtils.getMessage("SS3.buscar"));
        cleanButton.setText(LanguageUtils.getMessage("SS3.limpiar"));
        titleLabel.setText(LanguageUtils.getMessage("SS3.InformeEventosAsistente"));
        statusEventLabel.setText(LanguageUtils.getMessage("SS3.estadoEvento"));
        tipoEventotLabel.setText(LanguageUtils.getMessage("SS3.tipoEvento"));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(LanguageUtils.getMessage("SS3.criterioBusqueda")));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(LanguageUtils.getMessage("SS3.resultadoBusqueda")));

    }

    private void intialCharge() {
        cargaCombo(assistantCombo, "asistentes");
        cargaCombo(tipoEventoCombo, "tipoEventos");
        cargaCombo(statusEventCombo, "estadoEventos");
        List listCostByEvent = new ArrayList();
        resultTable = carregaResutTable(resultTable, listCostByEvent);
        if (aThis != null) {
            assistantCombo.setSelectedItem(selectedUser);
        }
    }

    private void cargaCombo(JComboBox combo, String string) {
        List lista = new ArrayList();
        try {
            if (string.equalsIgnoreCase("asistentes")) {
                lista = objetoRemoto.dameListaAsistentes();
                if (aThis != null) {
                    boolean trobat = false;
                    for (int i = 0; i < lista.size() && !trobat; i++) {
                        if ((aThis.getAcceso().getCod_usuario() + "").equalsIgnoreCase(((SS1_Usuario) lista.get(i)).getCodigo())) {
                            selectedUser = ((SS1_Usuario) lista.get(i));
                            trobat = true;
                        }
                    }
                    if (!trobat) {
                        selectedUser = new SS1_Usuario();
                        selectedUser.setCodigo(aThis.getAcceso().getCod_usuario() + "");
                        selectedUser.setNombre(aThis.getAcceso().getNombre());
                        selectedUser.setApellido1(aThis.getAcceso().getApellido1());
                        selectedUser.setApellido2(aThis.getAcceso().getApellido1());
                        lista.add(0, selectedUser);
                    }
                    combo.setEnabled(false);
                } else {
                    SS1_Usuario nullUser = new SS1_Usuario();
                    nullUser.setNombre("");
                    nullUser.setApellido1("");
                    nullUser.setApellido2("");
                    lista.add(0, nullUser);
                }
            } else if (string.equalsIgnoreCase("tipoEventos")) {
                lista = objetoRemoto.getComboTipoEvento();
                SS1_TipoEvento nullElement = new SS1_TipoEvento();
                nullElement.setId(-1);
                lista.add(0, nullElement);
            } else if (string.equalsIgnoreCase("estadoEventos")) {
                lista.add(new KeyValue());
                lista.add(new KeyValue(0, "Cerrado"));
                lista.add(new KeyValue(1, "Abierto"));
            }
        } catch (Exception ex) {
            ExceptionUtils.visualizarError(ExceptionUtils.ERR_Inesperado);
            Logger.getLogger(SS3_PantallaEventosAsistente.class.getName()).log(Level.SEVERE, null, ex);
        }
        ComponentsUtils.cargaCombo(combo, lista);
    }

    private JTable carregaResutTable(JTable table, List list) {
        table.removeAll();
        ModelResult model = new ModelResult(list);
        table.setModel(model);
        return table;
    }

    private void cercaResult() {

        List<SS3_InformeEventosAsistente> list = null;
        try {
            if (!fechaHastaField.getText().equalsIgnoreCase("")) {
                sdf.format(new Date(fechaHastaField.getText()));
            }
            if (!fechaDesdeField.getText().equalsIgnoreCase("")) {
                sdf.format(new Date(fechaDesdeField.getText()));
            }
            //Si visualizamos el informe desde el menu SS de conexion, comprobamos que tiene asistencias a evento el usuario registrado
            if (aThis != null) {
                if (assistantCombo.getSelectedItem() == null) {
                    ExceptionUtils.visualizarError(LanguageUtils.getMessage("SS3.fechaHasta"));
                    return;
                }
            }
            if (!fechaDesdeField.getText().equalsIgnoreCase("") &&
                    !fechaHastaField.getText().equalsIgnoreCase("") &&
                    new Date(fechaHastaField.getText()).before(new Date(fechaDesdeField.getText()))) {
                throw new FechasIncongruentesException();
            }
            list = (ArrayList<SS3_InformeEventosAsistente>) objetoRemoto.dameResultEventosAsistente(
                    (SS1_Usuario) assistantCombo.getSelectedItem(),
                    (SS1_TipoEvento) tipoEventoCombo.getSelectedItem(),
                    fechaDesdeField.getText(), fechaHastaField.getText(),
                    (KeyValue) statusEventCombo.getSelectedItem());
        } catch (FechasIncongruentesException ex) {
            ExceptionUtils.visualizarInformacion(LanguageUtils.getMessage("SS3.error.formato.fecha.incongruentes"));
            Logger.getLogger(SS3_PantallaEventosAsistente.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ParseException ex) {
            ExceptionUtils.visualizarInformacion(LanguageUtils.getMessage("SS3.error.formato.fecha.incorrecta"));
            Logger.getLogger(SS3_PantallaEventosAsistente.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex) {
            ExceptionUtils.visualizarError(LanguageUtils.getMessage("ERR_Remote"));
            Logger.getLogger(SS3_PantallaEventosAsistente.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalArgumentException ex) {
            ExceptionUtils.visualizarInformacion(LanguageUtils.getMessage("SS3.error.formato.incorrecto"));
            Logger.getLogger(SS3_PantallaEventosAsistente.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            ExceptionUtils.visualizarError(ExceptionUtils.ERR_Inesperado);
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
        }
        resultTable = carregaResutTable(resultTable, list);
    }

    class ModelResult extends AbstractTableModel {

        private static final long serialVersionUID = 1L;
        protected Vector<String> cabecera = new Vector<String>();
        protected Vector<Vector> eventosAsistente = new Vector<Vector>();

        public ModelResult(List<SS3_InformeEventosAsistente> lissS3_InformeEventosAsistente) {
            setCapcelera();
            setResulTabla(lissS3_InformeEventosAsistente);
        }

        private void setCapcelera() {
            cabecera.add(LanguageUtils.getMessage("SS3.universidad"));
            cabecera.add(LanguageUtils.getMessage("SS3.centro"));
            cabecera.add(LanguageUtils.getMessage("SS3.evento"));
            cabecera.add(LanguageUtils.getMessage("SS3.fechaInicio"));
            cabecera.add(LanguageUtils.getMessage("SS3.duracion"));
            cabecera.add(LanguageUtils.getMessage("SS3.duracion"));
            cabecera.add(LanguageUtils.getMessage("SS3.cerrado"));
            cabecera.add(LanguageUtils.getMessage("SS3.asistencia"));
        }

        private void setResulTabla(List<SS3_InformeEventosAsistente> listSS3_InformeEventosAsistente) {
            Vector<String> universityColumn = new Vector<String>();
            Vector<String> centerColumn = new Vector<String>();
            Vector<String> eventColumn = new Vector<String>();
            Vector<String> eventTypeColumn = new Vector<String>();
            Vector<String> initDateColumn = new Vector<String>();
            Vector<String> endDateColumn = new Vector<String>();
            Vector<String> closedColumn = new Vector<String>();
            Vector<String> assitantStatusColumn = new Vector<String>();
            for (Iterator<SS3_InformeEventosAsistente> it = listSS3_InformeEventosAsistente.iterator(); it.hasNext();) {
                SS3_InformeEventosAsistente sS3_InformeEventosAsistente = it.next();
                universityColumn.add(sS3_InformeEventosAsistente.getUniversidad());
                centerColumn.add(sS3_InformeEventosAsistente.getCentro());
                eventColumn.add(sS3_InformeEventosAsistente.getEvento());
                eventTypeColumn.add(sS3_InformeEventosAsistente.getTipoEvento());
                initDateColumn.add(sdf.format(sS3_InformeEventosAsistente.getFechaInicio()));
                endDateColumn.add(sS3_InformeEventosAsistente.getDuracion());
                closedColumn.add(sS3_InformeEventosAsistente.getCerrado().equalsIgnoreCase("1") ? "Abierto" : "Cerrado");
                assitantStatusColumn.add(sS3_InformeEventosAsistente.getEstadoAsistente() == true ? "Si" : "No");
            }
            eventosAsistente.add(universityColumn);
            eventosAsistente.add(centerColumn);
            eventosAsistente.add(eventColumn);
            eventosAsistente.add(eventTypeColumn);
            eventosAsistente.add(initDateColumn);
            eventosAsistente.add(endDateColumn);
            eventosAsistente.add(closedColumn);
            eventosAsistente.add(assitantStatusColumn);
        }

        public int getRowCount() {
            return (((Vector) eventosAsistente.get(0)).size());
        }

        public int getColumnCount() {
            return (eventosAsistente.size());
        }

        @Override
        public String getColumnName(int col) {
            return ((String) cabecera.get(col));
        }

        public boolean getScrollableTrackViewportHeight() {
            return (true);
        }

        public boolean getScrollableTrackViewportWidth() {
            return (true);
        }

        public Object getValueAt(int fila, int col) {
            return (((Vector) eventosAsistente.get(col)).get(fila));
        }

        @Override
        public boolean isCellEditable(int fila, int columna) {
            return (false);
        }
    }
}
